package cn.zniot.so.apiprovide.business;

import cn.zniot.so.application.data.BcmStatus;

import net.sf.json.JSON;
import net.sf.json.JSONSerializer;



public abstract class AbstractHandler
{
	/*
	 * 方法名：getFailedResponse(ZniotException e)
	 * 功　能：没有匹配的url返回的错误状态码指示
	 * 参　数：ZniotException e      -&异常消息
	 * 返回值：ZniotResponse - &服务响应给客户端的内容
	 */
	public Response getFailedResponse(Exception e)
	{
		return new ErrorResponse(e);
	}

	/*
	 * 方法名：pageMaker(String body)
	 * 功　能：拼装成xml文件格式的字符串
	 * 参　数：String body -&消息实体内容
	 * 返回值：String - &xml文件字符串
	 */
	protected String pageMaker(String body)
	{
	    BcmStatus bcmStatus = new BcmStatus();
        bcmStatus.setStatusCode(body);
        JSON json = JSONSerializer.toJSON(bcmStatus);
        return json.toString();
	}
}
